﻿@model ManufacturerModel
@{
    Layout = "~/Views/Shared/_ColumnsThree.cshtml";
    Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Name);
    Html.AddMetaDescriptionParts(Model.MetaDescription);
    Html.AddMetaKeywordParts(Model.MetaKeywords);

    var canonicalUrlsEnabled = EngineContext.Current.Resolve<SeoSettings>().CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var manufacturerUrl = Url.RouteUrl("Manufacturer", new { SeName = Model.SeName }, this.Request.Url.Scheme);
        Html.AddCanonicalUrlParts(manufacturerUrl);
    }
}
@using Nop.Core;
@using Nop.Core.Domain.Common;
@using Nop.Core.Domain.Seo;
@using Nop.Core.Infrastructure;
@using Nop.Web;
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
<div class="page manufacturer-page">
   
        @Html.Widget("manufacturerdetails_top")
    @*description*@
    @if (!String.IsNullOrWhiteSpace(Model.Description))
    {
        <div class="manufacturer-description">
            @Html.Raw(Model.Description)
        </div>
    }
        @Html.Widget("manufacturerdetails_before_featured_products")
    @*featured products*@
    @if (Model.FeaturedProducts.Count > 0)
    {
        <div class="product-grid featured-product-grid">
            <div class="grid-header">
                <h2 class="title">@T("Products.FeaturedProducts")</h2>
            </div>
            <div class="item-grid">
                @foreach (var item in Model.FeaturedProducts)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", item)
                    </div>
                }
            </div>
        </div>
    }
        @Html.Widget("manufacturerdetails_after_featured_products")
        <div class="product-selectors">
        @*view mode*@
        @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
        {
            <div class="product-viewmode filtersDropDownPanel">
                <span>@T("Categories.ViewMode")</span>
                @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { onchange = "setLocation(this.value);" })
            </div>
        }   
    
    
        @*sorting*@
        @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
        {
            <div class="product-sorting filtersDropDownPanel">
                <span>@T("Categories.OrderBy")</span>
                @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { onchange = "setLocation(this.value);" })
            </div>
        }
    
        @*page size*@
        @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
        {
            <div class="product-page-size filtersDropDownPanel">
                <span>@T("Manufacturers.PageSize")</span>
                @Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { onchange = "setLocation(this.value);" })
                <span>@T("Manufacturers.PageSize.PerPage")</span>
            </div>
        }
    </div>
        @Html.Widget("manufacturerdetails_before_filters")
    @*filtering*@
    @if (Model.PagingFilteringContext.PriceRangeFilter.Enabled)
    {
        <div class="product-filters">
            <div class="filter-title">
                <span>@T("Filtering.FilterResults")</span>
            </div>
            <div class="filter-item">
                @Html.Partial("_FilterPriceBox", Model.PagingFilteringContext.PriceRangeFilter, new ViewDataDictionary())
            </div>
        </div>
    }
        @Html.Widget("manufacturerdetails_before_product_list")
    @*product list*@
    @if (Model.Products.Count > 0)
    {
        <div class="category-title">
            <h2 class="title">@Model.Name</h2>
        </div>
        
        if (Model.PagingFilteringContext.ViewMode == "list")
        {
@*list mode*@
        <div class="product-list">
            <div class="item-grid">
                @foreach (var product in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", product)
                    </div>
                }
            </div>
        </div>      
        }
        else
        {
@*grid mode*@
        <div class="product-grid">
            <div class="item-grid">
                @foreach (var item in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", item)
                    </div>
                }
            </div>
        </div>
        }
    }
    <div class="pager">
        @if (Model.PagingFilteringContext.TotalPages > 1)
        {
            <div>
                @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
            </div>                
            <div class="corner"></div>
        }
    </div>
    @Html.Widget("manufacturerdetails_bottom")
</div>
